From e697c7e8ef32b4248f002d6e6eb989e56440e499 Mon Sep 17 00:00:00 2001 From: Xiaofeng Ling Date: Tue, 13 Dec 2005 10:57:04 +0000 Subject: [PATCH] change the NIC configuration accordingly after remove "nics=n" otherwise, nics=-1 will be passed to device model and cause device model exiting. Signed-off-by: Xiaofeng Ling --- tools/examples/xmexample.vmx | 2 ++ tools/python/xen/xend/image.py | 8 +++++--- tools/python/xen/xm/create.py | 3 +-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/tools/examples/xmexample.vmx b/tools/examples/xmexample.vmx index 8b694e32fe..6144be86d4 100644 --- a/tools/examples/xmexample.vmx +++ b/tools/examples/xmexample.vmx @@ -42,6 +42,8 @@ vcpus=1 nics=1 # type=ioemu specify the NIC is an ioemu device not netfront vif = [ 'type=ioemu, bridge=xenbr0' ] +# for multiple NICs in device model, 3 in this example +#vif = [ 'type=ioemu, bridge=xenbr0', 'type=ioemu', 'type=ioemu'] #---------------------------------------------------------------------------- # Define the disk devices you want the domain to have access to, and diff --git a/tools/python/xen/xend/image.py b/tools/python/xen/xend/image.py index b60c5f4754..76d91709d7 100644 --- a/tools/python/xen/xend/image.py +++ b/tools/python/xen/xend/image.py @@ -238,9 +238,7 @@ class VmxImageHandler(ImageHandler): # xm config file def parseDeviceModelArgs(self, imageConfig, deviceConfig): dmargs = [ 'cdrom', 'boot', 'fda', 'fdb', 'ne2000', - 'localtime', 'serial', 'stdvga', 'isa', 'vcpus', - 'nics' - ] + 'localtime', 'serial', 'stdvga', 'isa', 'vcpus'] ret = [] for a in dmargs: v = sxp.child_value(imageConfig, a) @@ -262,6 +260,7 @@ class VmxImageHandler(ImageHandler): # Handle disk/network related options mac = None ret = ret + ["-domain-name", "%s" % self.vm.info['name']] + nics = 0 for (name, info) in deviceConfig: if name == 'vbd': uname = sxp.child_value(info, 'uname') @@ -283,6 +282,7 @@ class VmxImageHandler(ImageHandler): type = sxp.child_value(info, 'type') if type != 'ioemu': continue + nics += 1 if mac != None: continue mac = sxp.child_value(info, 'mac') @@ -299,6 +299,8 @@ class VmxImageHandler(ImageHandler): instance = sxp.child_value(info, 'pref_instance') ret.append("-instance") ret.append("%s" % instance) + ret.append("-nics") + ret.append("%d" % nics) return ret def configVNC(self, config): diff --git a/tools/python/xen/xm/create.py b/tools/python/xen/xm/create.py index 622bea9b18..34d6317000 100644 --- a/tools/python/xen/xm/create.py +++ b/tools/python/xen/xm/create.py @@ -545,8 +545,7 @@ def configure_vmx(config_image, vals): """ args = [ 'device_model', 'vcpus', 'cdrom', 'boot', 'fda', 'fdb', 'localtime', 'serial', 'stdvga', 'isa', 'nographic', - 'vnc', 'vncviewer', 'sdl', 'display', 'ne2000', 'lapic', - 'nics'] + 'vnc', 'vncviewer', 'sdl', 'display', 'ne2000', 'lapic'] for a in args: if (vals.__dict__[a]): config_image.append([a, vals.__dict__[a]]) -- 2.30.2